package com.lipy.springcloudzuul.routeMapper;

import org.springframework.cloud.netflix.zuul.filters.discovery.PatternServiceRouteMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description:
 * @author: lipy
 * @create: 2020-06-27 18:55
 **/
//@Configuration
public class PatternServiceRouteMapperConfig {

    @Bean
    public PatternServiceRouteMapper patternServiceRouteMapper(){
        /*
         * servicePattern 指定微服务的正则
         * routePattern  指定路由正则
         * */
        return new PatternServiceRouteMapper("(?<name>^.+)-(?<version>v.+$)",
                "${version}/${name}");
    }
}
